package com.ay.demo.guava.eventbus;

import com.ay.demo.guava.eventbus.event.AllowConcurrentEvent;
import com.ay.demo.guava.eventbus.event.SyncEvent;
import com.google.common.eventbus.AllowConcurrentEvents;
import com.google.common.eventbus.Subscribe;

public class EventBusSubscriber {
	private static int i;

	@Subscribe
	public void onEvent(SyncEvent event) {
		System.out.println("onSyncEvent:" + Thread.currentThread().getName() + " - " + i++);
	}
	
	@AllowConcurrentEvents
	@Subscribe
	public void onAllowConcurrentEvent(AllowConcurrentEvent event) {
		System.out.println("onAllowConcurrentEvent:" + Thread.currentThread().getName() + " - " + i++);
	}
}
